<template>
	<view class="bingli">
		<view class="bingli-hd">
			<view class="bingli-hd-left">
				病历编号:
			</view>
			<view class="bingli-hd-right">
				<input type="text" value="" v-model="form.idcard" />
			</view>
		</view>
		<view class="bingli-hd">
			<view class="bingli-hd-left">
				就诊日期:
			</view>
			<view class="bingli-hd-right">
				<!-- {{val.nr}} -->
				<input type="text" value="" />
			</view>
		</view>
		<view class="bingli-hd">
			<view class="bingli-hd-left">
				科室:
			</view>
			<view class="bingli-hd-right">
				<!-- {{val.nr}} -->
				<input type="text" value="" v-model="form.keshi" />
			</view>
		</view>
		<view class="bingli-hd">
			<view class="bingli-hd-left">
				患者姓名:
			</view>
			<view class="bingli-hd-right">
				<!-- {{val.nr}} -->
				<input type="text" value="" v-model="form.huanzhename" />
			</view>
		</view>
		<view class="bingli-hd">
			<view class="bingli-hd-left">
				联系电话:
			</view>
			<view class="bingli-hd-right">
				<!-- {{val.nr}} -->
				<input type="text" value="" v-model="form.huangzhedianhua" />
			</view>
		</view>
		<view class="bingli-nr-yi">
			<view class="bingli-nr-left">
				<view class="bingli-nr-left-lf">
					性别：
				</view>
				<view class="bingli-nr-left-rh">
					<input type="text" v-model="form.sex">
				</view>
			</view>
			<view class="bingli-nr-left">
				<view class="bingli-nr-left-lf">
					年龄：
				</view>
				<view class="bingli-nr-left-rh">
					<input type="text" v-model="form.age">
				</view>
			</view>
			<view class="bingli-nr-left">
				<view class="bingli-nr-left-lf">
					婚否：
				</view>
				<view class="bingli-nr-left-rh">
					<input type="text" v-model="form.ismarry">
				</view>
			</view>
		</view>
		<view class="bingli-nr">
			<view class="bingli-nr-left">
				<view class="bingli-nr-left-lf">
					身高：
				</view>
				<view class="bingli-nr-left-rh">
					<input type="text" v-model="form.shengao">
				</view>
			</view>
			<view class="bingli-nr-left">
				<view class="bingli-nr-left-lf">
					体重：
				</view>
				<view class="bingli-nr-left-rh">
					<input type="text" v-model="form.tizhong">
				</view>
			</view>
		</view>


		<view class="bingli-db">
			<view class="bingli-db-hd">
				患者过敏史:
			</view>
			<view class="bingli-db-db">
				<textarea name="" id="" cols="30" rows="10" v-model="form.guoming"></textarea>
			</view>
		</view>
		<view class="bingli-db">
			<view class="bingli-db-hd">
				患者病史:
			</view>
			<view class="bingli-db-db">
				<textarea name="" id="" cols="30" rows="10" v-model="form.binghistory"></textarea>
			</view>
		</view>
		<view class="bingli-db">
			<view class="bingli-db-hd">
				临床(初步)诊断:
			</view>
			<view class="bingli-db-db">
				<textarea name="" id="" cols="30" rows="10" v-model="form.linchuang"></textarea>
			</view>
		</view>
		<!-- <view class="bingli-db">
			<view class="bingli-db-hd" @click="$pub.go(rp_url)">
				Rp:
			</view>
			<view class="bingli-db-db">
				<view class="bingli-db-db" v-if="arr.length==0">
					<textarea name="" id="" cols="30" rows="10" v-model="form.huangzhezhusubingqing"></textarea>
				</view>
				<view class="" v-for="(val,i) in arr" :key="i" v-else>
					<view class="bingli-db-db">
						{{val.utradeName}}
					</view>
					<view class="bingli-db-db-cen"
						style="display: flex; align-items: center; justify-content: space-between;">
						<view class="bingli-db-db-cen-le">
							型号: {{val.uproductModel}}
						</view>
						<view class="bingli-db-db-cen-le">
							规格: {{val.uproductSpecs}}
						</view>
						<view class="bingli-db-db-cen-le">
							数量: {{arrs[i]}}
						</view>
					</view>
				</view>

			</view>

		</view> -->
		<view class="bingli-nr">
			<view class="bingli-nr-left">
				<view class="bingli-nr-left-lf">
					就诊医生：
				</view>
				<view class="bingli-nr-left-rh">
					<input type="text" v-model="form.yishengname">
				</view>
			</view>
			<view class="bingli-nr-left">
				<view class="bingli-nr-left-lf">
					业务审核：
				</view>
				<view class="bingli-nr-left-rh">
					<input type="text" v-model="form.yewushenhe">
				</view>
			</view>

		</view>
		<!-- <view class="bingli-hd">
			<view class="bingli-hd-left">
				打印时间:
			</view>
			<view class="bingli-hd-right">
				<input type="text" value="" v-model="form.dayintime" />
			</view>
		</view>

		<view class="di  main" v-show="name">
			<button class="btn  btn-big" hover-class="btn-hor" @click="fashou()">发送</button>
		</view> -->
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		data() {
			return {
				arr: [],
				arrs: [],
				uproductids: [],
				type:'',
				id: '',
				form: {
					id: '',
					hospital: '',
					keshi: '',
					yishenguserid: '',
					huangzheuserid: '',
					productid: [],
					yishengname: '',
					idcard: '',
					huanzhename: '',
					huangzhedianhua: '',
					shengao: '',
					chushendate: '',
					sex: '',
					tizhong: '',
					age: '',
					ismarry: '',
					guoming: '',
					binghistory: '',
					createtime: '',
					utype: '处方',
					menzhenhao: '',
					jiuzhenhao: '',
					dayintime: '',
					huangzhezhusubingqing: '',
					yewushenhe: '',
					linchuang: '',
					productnum: '',
				},
			};
		},
		onLoad(id) {
			this.id = id.id
			this.name = id.name
			this.toid = id.toid
			this.type = id.type
			this.location = id.wz
			this.getList()
		},
		methods: {
			fashou(){
				// type 1文字 2语音 3图片 4视频 5文件
				console.log(this.toid,this.id,this.name,uni.getStorageSync('name'),uni.getStorageSync('ID'));
				let msg = {
					"code": "2",
					"message": {
						"toId": this.toid,
						"name": uni.getStorageSync('name'),
						"avatar": "profile/2023/02/22/20230222105702A001.png",
						"type": 6,
						"fromId": uni.getStorageSync('ID'),
						"content": this.id,
						"second": '',
						"taskId": "taskId",
						"second": "",
						"createTime": this.nowTime,
						"messageId": "1628231595821391872",
						"messageType": 0,
						"nameId":1,
						"qunNmae":this.name,
						"weizhi":this.location,
					}
				}
				this.$ws.send(JSON.stringify(msg))
				uni.navigateBack({
				    delta: 2
				});
			},
			getList() {
				this.request({
					url: '/richangjingying/selectBingLiById?Id=' + this.id,
				}).then(res => {
					console.log(res, 666);
					this.form = res.data
					// log
					// console.log(this.lists[4].udoorFacePic,26);
					this.uproductids.push(res.data.productid)
					console.log(this.form.productnum, 9666);
					this.arrs = this.form.productnum.split(',')
					console.log(this.arrs, 8998);
					this.getRe()
				})
			},
			getRe() {
				this.request({
					url: '/web/mall/product/seleArr/' + this.uproductids,
				}).then(res => {
					console.log(res, 666);
					this.arr = res.data
					console.log(this.arr);
					// this.form = res.data
					// log
					// console.log(this.lists[4].udoorFacePic,26);
				})

			}
		},
		computed: {
			...mapState({
				deviceInfo: state => state.deviceInfo,
			})
		},
	}
</script>

<style lang="less">
	.bingli {
		background-color: #f5f5f5;
		height: 100%;
		// padding-bottom: 140rpx;

		.bingli-hd {
			display: flex;
			align-items: center;
			line-height: 80rpx;
			background-color: #fff;
			font-size: 30rpx;
			margin-bottom: 10rpx;

			.bingli-hd-left {
				// border-right: 5px solid #f5f5f5;
				padding: 0 20rpx;
			}

			.bingli-hd-right {
				// text-align: center;
				flex-grow: 1;
			}
		}

		.bingli-nr {
			display: flex;
			align-items: center;
			line-height: 70rpx;
			padding: 0 20rpx;
			box-sizing: border-box;
			background-color: #fff;
			border-bottom: 10rpx solid #f5f5f5;

			.bingli-nr-left {
				width: 50%;
				display: flex;
				align-items: center;

				.bingli-nr-left-rh {
					input {
						width: 170rpx;
					}

					width: 170rpx;
				}
			}

		}

		.bingli-nr-yi {
			display: flex;
			align-items: center;
			line-height: 70rpx;
			padding: 0 20rpx;
			box-sizing: border-box;
			background-color: #fff;
			border-bottom: 10rpx solid #f5f5f5;

			.bingli-nr-left {
				width: 34%;
				display: flex;
				align-items: center;

				.bingli-nr-left-rh {
					input {
						width: 120rpx;
					}

					width: 120rpx;
				}
			}
		}

		.bingli-db {
			padding: 20rpx;
			background-color: #fff;
			font-size: 30rpx;
			margin-bottom: 10rpx;
			line-height: 70rpx;

			.bingli-db-db {
				text-align: center;

				textarea {
					width: 100%;
					height: 150rpx;
				}
			}
		}

		.fashou {
			background-color: chocolate;
			text-align: center;
			line-height: 100rpx;
			color: #fff;
		}
	}
</style>
